/*
 * @Author: Tendo 
 * @Date: 2021-09-18 10:52:06 
 * @param {number[]} nums1
 * @param {number[]} nums2
 * @return {number[]}
 * @desc Set()
 */
var intersection = function(nums1, nums2) {
    let m = nums1.length,
        n = nums2.length;
    if(m < n) {
        [nums1, nums2] = [nums2, nums1];
    }
    let nums1Set = new Set(nums1),
        resSet = new Set();
    for(let i = nums2.length - 1; i >= 0; i--) {
        nums1Set.has(nums2[i]) && resSet.add(nums2[i]);
    }
    return Array.from(resSet)
};